package com.changgou.order.mq.listener;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Component
@RabbitListener(queues = "orderListenerQuery")
public class DelayMessageListener {
    /**
     * 延时队列的监听
     * @param message   监听到的消息
     */
    @RabbitHandler
    public  void getMessage(String message){
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         System.out.println("监听消息的时间是:"+new Date());
         System.out.println("监听到的消息:"+message);
    }
}
